package mx.com.crowdgine.display.animation.mocap;

import junit.framework.Assert;

import org.junit.Test;

public class AMCFileTest {

	@Test
	public void testAMCFileParse() {
		String fileName = "Assets/Mocap/12_01.amc";
		AMCFile amcFile = new AMCFile(fileName);
		
		Assert.assertEquals(":DEGREES", amcFile.getRotationUnits());
		
		Assert.assertNotNull(amcFile.getAmcFrames());
		Assert.assertEquals(523, amcFile.getAmcFrames().size());
		
		AMCFrame amcFrame = amcFile.getAmcFrames().get(0);
		Assert.assertEquals(1, amcFrame.getId());
		Assert.assertNotNull(amcFrame.getAmcBones());
		Assert.assertEquals(29, amcFrame.getAmcBones().size());
		
		float [] values = null;
		
		
		AMCBone root = amcFrame.getAmcBones().get(0);
		Assert.assertNotNull(root);
		Assert.assertNotNull(root.getValues());
		Assert.assertEquals(6, root.getValues().length);
		values = root.getValues();
		Assert.assertEquals(0.0265202f, values[0]);
		Assert.assertEquals(16.2134f, values[1]);
		Assert.assertEquals(-25.4911f, values[2]);
		Assert.assertEquals(0.434917f, values[3]);
		Assert.assertEquals(-2.05064f, values[4]);
		Assert.assertEquals(5.16773f, values[5]);
		
		
		
		AMCBone lclavicle = amcFrame.getAmcBones().get(14);
		Assert.assertNotNull(lclavicle);
		Assert.assertNotNull(lclavicle.getValues());
		Assert.assertEquals(2, lclavicle.getValues().length);
		values = lclavicle.getValues();
		Assert.assertEquals(2.43511e-015f, values[0]);
		Assert.assertEquals(3.97569e-015f, values[1]);
	}
	
}
